#!/bin/bash
#chkconfig: 5 80 90
#description:myJava
#
 
# source function library
#. /etc/rc.d/init.d/functions
port="8089"
name="ifs"
serverName="server3"
linkedName="$serverName-$name-$port"
webPath="/"
start()
{
    echo -n $"Starting $prog: "
    echo "Hello Linux Service"
    cd "$webPath$name$port/"
    java -version
    echo "started with $linkedName"
    java -Xms64m -Xmx512m -Dname="$linkedName" org.springframework.boot.loader.JarLauncher --spring.profiles.active=stg --server.port=$port
#    echo "CLASSPATH: ${CLASSPATH}"
#    echo "PATH: ${PATH}"
#    java -classpath $CLASSES MyFrame
#    /usr/work/space1/bin/MyFrame start

}
 
stop()
{
   echo -n $"Stopping $linkedName: "
   pkill -f "$linkedName"
   #kill [']netstat -nlp | grep :$port | awk '{print $7}' | awk -F"/" '{ print $1 }'[']
}
 
restart()
{
    echo -n $"Reloading $prog: "
}
 
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        restart
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart}"
        RETVAL=1
esac
exit $RETVAL